package com.ruoyi.expert.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.expert.domain.ExpertPestControl;
import com.ruoyi.expert.mapper.ExpertPestControlMapper;
import com.ruoyi.expert.service.IExpertPestControlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 病虫害防治Service业务层处理
 *
 * @author ruoyi
 * @date 2022-03-10
 */
@Service
public class ExpertPestControlServiceImpl implements IExpertPestControlService
{
    @Autowired
    private ExpertPestControlMapper expertPestControlMapper;

    /**
     * 查询病虫害防治
     *
     * @param expertdbId 病虫害防治主键
     * @return 病虫害防治
     */
    @Override
    public ExpertPestControl selectExpertPestControlByExpertdbId(Long expertdbId)
    {
        return expertPestControlMapper.selectExpertPestControlByExpertdbId(expertdbId);
    }

    /**
     * 查询病虫害防治列表
     *
     * @param expertPestControl 病虫害防治
     * @return 病虫害防治
     */
    @Override
    public List<ExpertPestControl> selectExpertPestControlList(ExpertPestControl expertPestControl)
    {
        return expertPestControlMapper.selectExpertPestControlList(expertPestControl);
    }

    /**
     * 新增病虫害防治
     *
     * @param expertPestControl 病虫害防治
     * @return 结果
     */
    @Override
    public int insertExpertPestControl(ExpertPestControl expertPestControl)
    {
        expertPestControl.setCreateTime(DateUtils.getNowDate());
        return expertPestControlMapper.insertExpertPestControl(expertPestControl);
    }

    /**
     * 修改病虫害防治
     *
     * @param expertPestControl 病虫害防治
     * @return 结果
     */
    @Override
    public int updateExpertPestControl(ExpertPestControl expertPestControl)
    {
        expertPestControl.setUpdateTime(DateUtils.getNowDate());
        return expertPestControlMapper.updateExpertPestControl(expertPestControl);
    }

    /**
     * 批量删除病虫害防治
     *
     * @param expertdbIds 需要删除的病虫害防治主键
     * @return 结果
     */
    @Override
    public int deleteExpertPestControlByExpertdbIds(Long[] expertdbIds)
    {
        return expertPestControlMapper.deleteExpertPestControlByExpertdbIds(expertdbIds);
    }

    /**
     * 删除病虫害防治信息
     *
     * @param expertdbId 病虫害防治主键
     * @return 结果
     */
    @Override
    public int deleteExpertPestControlByExpertdbId(Long expertdbId)
    {
        return expertPestControlMapper.deleteExpertPestControlByExpertdbId(expertdbId);
    }
}
